﻿using System;
using System.Collections.Generic;

    class BinaryToDecimal
    {     

        static void Main(string[] args)
        {
            Console.Write("Enter binary number: ");
            string binary = Console.ReadLine();
            int decimalNum = 0;
            int count = binary.Length - 1;
            for(int i=0; i<binary.Length; i++)
            {
                decimalNum=decimalNum + int.Parse(binary[i].ToString())*(int)Math.Pow(2,count);
                count--;
            }
            Console.WriteLine("The decimal representation of {0} is: {1}",binary,decimalNum);            

        }
    }

